package zhj.test.ballmove;

import java.util.ArrayList;


public class Thread1 extends Thread{
	private BounceFrame frame;
	private BallPanel panel;
	public static final int DELAY = 3;

	Thread1(BounceFrame f,BallPanel p)
	{
		frame = f;
		panel = p;
	}

	public void run() {
		try{


			while(true)
			{
				ArrayList<Ball> balls = panel.GetBalls(); 
				for(Ball ball:balls)
				{
					ball.move(panel.getBounds());
				}
				panel.paint(panel.getGraphics());
				Thread.sleep(DELAY);

			}
		}
		catch (InterruptedException  e)
		{

		}
	}

}
